#!/bin/bash

FILE=$1
FILE_NAME=${FILE##*/}

AXIOMS=`grep '^include(' $FILE | tr -d '\n'|sed "s|include('[^']*/\([^./]*\).ax').|\1,|g"|sed 's/,$//'`
STATUS=`grep '% Status   :' $FILE |sed 's/^[^:]*: \(.*\)$/\1/'`
NAME=`grep '% Problem  :' $FILE |sed 's/^[^:]*: \(.*\)$/\1/'`
SHORT=`echo $FILE_NAME |sed 's/\..*//'`
DIVISION=`echo $FILE_NAME |sed 's/\(...\).*/\1/'`

echo "$DIVISION	$SHORT	$NAME	$STATUS	$AXIOMS"
